var table;
layui.use('table', function(){
    table = layui.table
        ,form = layui.form;
    table.render({
        elem: '#address'
        ,url:'/getAddressList'
        ,cellMinWidth: 80
        ,cols: [[
            {type:'numbers'}
            ,{type: 'checkbox'}
            ,{field:'userId', title:'用户ID'}
            ,{field:'provinceName', title:'省'}
            ,{field:'cityName', title:'市'}
            ,{field:'areaName', title: '区'}
            ,{field:'detailAddr', title: '详细地址'}
            ,{field:'name', title: '姓名'}
            ,{field:'phone', title: '手机号'}
            ,{field:'id', title:'编辑', minWidth:180, templet: '#barDemo', unresize: true}
        ]]
        ,page: true
    });
});

function createTime(v){
    return new Date(parseInt(v)).toLocaleString()
}
/**重写toLocaleString方法*/
Date.prototype.toLocaleString = function() {
    var y = this.getFullYear();
    var m = this.getMonth()+1;
    m = m<10?'0'+m:m;
    var d = this.getDate();
    d = d<10?("0"+d):d;
    var h = this.getHours();
    h = h<10?("0"+h):h;
    var M = this.getMinutes();
    M = M<10?("0"+M):M;
    var S=this.getSeconds();
    S=S<10?("0"+S):S;
    return y+"-"+m+"-"+d+" "+h+":"+M+":"+S;}

function openDetails() {
    layer.open({
        type: 2
        , title: '添加会员等级'
        , content: '/getOrderDetails'
        , area: ['420px', '420px']
        , btn: ['确定', '取消']
        , yes: function (index, layero) {
            debugger;
            var body = layer.getChildFrame('body', index); //得到iframe页的body内容
            var loginname = body.find("#loginname").val();
            alert(loginname);

            //table.reload('LAY-user-front-submit'); //数据刷新
            layer.close(index); //关闭弹层
        }
    });
}




